﻿using AutoUpdater.Entity;
using AutoUpdater.Util;
using PalletPrintProgram.Helper;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AutoUpdater.Bll
{
    public class FileCheckBll
    {
        private static string _serverUrl;
        public static string ServerUrl {
            get {
                if(!string.IsNullOrEmpty(_serverUrl))
                {
                    return _serverUrl;
                }
                _serverUrl = ConfigurationManager.AppSettings["ServerUrl"]; 
                return _serverUrl;
            }
        }
        public static TscResponse<SysBasicInfo> CheckBaseSys(string sysCode)
        {
            return RestHttpHelper.PostJson<SysBasicInfo>(ServerUrl + "/file/getSysByCode", new { sysCode });
        }

        public static TscResponse<string> SendFile(Dictionary<string, string> otherData, byte[] file1, string name, string contentType = null)
        {
            return RestHttpHelper.SendFile(ServerUrl+ "/file/upload", otherData, file1, name, contentType);
        }
    }
}
